#include "widget.h"
#include "ui_widget.h"

#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 设置随机种子. 使用时间戳作为随机种子.
        srand(time(0));
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_accept_clicked()
{
//    qDebug() << "祝你在你的C++学习的路上技术不断的提高！";
    ui->label->setText("祝你在你的C++学习的路上技术不断的提高！");
}

void Widget::on_pushButton_reject_pressed()
{

    // 获取当前窗口的尺寸
    int width = this->geometry().width();
    int height = this->geometry().height();

//    qDebug() << width  << height;


//    int frameWidth = this->frameGeometry().width();
//    int frameHeight = this->frameGeometry().height();
//    qDebug() << "frame: " << frameWidth << frameHeight;

    int x = rand() % width;
    int y = rand() % height;

    ui->pushButton_reject->move(x, y);

    qDebug() << x << y ;

}
